/**
 * @projectDescription functions for main.html
 * MUNS copyright, 2010
 * @author xkx
 */
window.addEvent('domready',main);
function main()
	{
		//test data
		conference_data = {
			'conference_name' : "XXX ModelUN Conference",
			'nations_in_conference' : ["Afghanistan","Albania","Algeria"],
			'nations_with_vote_right' : MUN.util.nation_names,
			'committee_name' : "XXX Committee",
			'session_no' : 1,
			'topics' : ["Topic A", "Topic B"],
			'current_topic' : ''
		}
		//visible element
		var top_menu = new UvumiDropdown("dropdown-menu");
		$('conference-name').innerHTML = conference_data.conference_name;
		document.title = conference_data.conference_name;
		$("mun-copyright").innerHTML = MUN.copyrightHTML;
		MUN.module.motion.create('main-m-button').inject($('tool'));
		MUN.module.submit.create('main-s-button').inject($('tool'));
		
		$('conference-word').innerHTML = conference_data.conference_name;
		$('committee-word').innerHTML = conference_data.committee_name;
		$('session-no').innerHTML = conference_data.session_no;
		$('topic-word').innerHTML = conference_data.topics;
		
		
		//define varibles
		present_nations = [];
		not_speaking_nations = [];
		
		//entries setting
		add_s_nation = MUN.module.autocompleter.create('add-s-nation', conference_data.nations_in_conference, true, "Add to Speakers' List");
		add_p_nation = MUN.module.autocompleter.create('add-p-nation', conference_data.nations_in_conference, true, "Add to Present List");
		MUN.status.set_add_s_nation_diabled();
		MUN.status.set_add_p_nation_diabled();
		
		//resize
		resize_list();
		window.addEvent("resize",resize_list);
		
		//begin conference
		start();
	}
function resize_list()
	{
		for(var i = 0;i<4;i++)
		{ //for firefox debug #7
			$("list").style.height = $(document).getSize().y - $("list").getPosition().y - $("add-p-nation-form").getSize().y - $("add-s-nation-form").getSize().y - 6 + "px";
			$('board').style.height = $('list').getSize().y + $("add-p-nation-form").getSize().y + "px";
		}
	}
function start()
	{
		var welcome_box = new MUN.module.board_box.create("welcome-box");
		welcome_box.header.innerText = "Welcome to " + conference_data.conference_name;
		welcome_box.content.grab(new Element('div',{'class':'_welcomebox-info', 'text':'Committee Name:'+conference_data.committee_name}));
		welcome_box.content.grab(new Element('div',{'class':'_welcomebox-info','text':'Topic:'+conference_data.topics}));
		welcome_box.content.grab(new Element('div',{'class':'_welcomebox-info','text':'Session No.:'+conference_data.session_no}));
		welcome_box.tools.innerHTML = "<button id='start_rollcall_b' onclick='start_rollcall.apply(this);'>Start Roll Call</button>";
	}
function start_rollcall()
	{
		this.disabled = 'disabled';
		var rollcall_box = new MUN.module.board_box.create("rollcall-box");
		rollcall_box.header.innerText = "Roll Call";
		var rollcall = new MUN.module.rollcall(rollcall_box.content,conference_data.nations_in_conference,"check");
		rollcall.add_status_element('main-status-area');
		rollcall_box.tools.grab(MUN.module.motion.create('rollcall-m-button'));
		MUN.module.board_box.toBottom();
		rollcall.init();
	}